<?php if (!isset($_SESSION)) { session_start(); }
include("includes/db.conn.php");
include("includes/conf.class.php");
$checkexist=mysql_query("select booking_id,email from netbiz_bookings where booking_id=".$_POST['booking_id']." and email='".$_POST['email']."'");
if(mysql_num_rows($checkexist))
{
	$random = substr(number_format(time() * rand(),0,'',''),0,4);
	$updateQuery=mysql_query("update netbiz_bookings set otp=".$random." where booking_id='".$_POST['booking_id']."'");
	$to=$_POST['email'];	
		//$to='anujanetbiz@gmail.com';	
		$headers = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
		$headers .= 'From: <info@netbizlabs.com>' . "\r\n";		
		$subject='Booking Details';
		$message=$random;
		$mail=mail($to,$subject,$message,$headers);
		
	echo 'yes';
}
else
{
	echo 'no';
}

?>